class Solution
{
public:
    bool canBeIncreasing(vector<int> &nums)
    {
        bool deleted = false;
        for (int i = 1; i < nums.size(); ++i)
        {
            if (nums[i] <= nums[i - 1])
            {
                if (deleted)
                {
                    return false;
                }
                else if (i == 1 || nums[i] > nums[i - 2])
                {
                    deleted = true;
                }
                else if (i == nums.size() - 1 || nums[i + 1] > nums[i - 1])
                {
                    ++i;
                    deleted = true;
                }
                else
                {
                    return false;
                }
            }
        }
        return true;
    }
};